<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bfl.ai/v1/flux-dev",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user' => '<string>',
'prompt' => 'ein fantastisches bild',
'image_prompt' => '<string>',
'width' => 1024,
'height' => 768,
'steps' => 28,
'prompt_upsampling' => false,
'seed' => 42,
'guidance' => 3,
'safety_tolerance' => 2,
'output_format' => 'jpeg',
'webhook_url' => '<string>',
'webhook_secret' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}